clear

*import excel "C:\Users\abrah\Dropbox\Paper AA-GM\Analysis for new experiment\Study2.xlsx", sheet("Sheet0") firstrow
import excel "/Users/gwynethmcclendon/Dropbox/Paper AA-GM/Replication materials Overtly Religious Appeals JOP/Study2.xls", sheet("Sheet0") firstrow

destring, replace



*************************
**Treatments**

*Generate numeric message treatments and dummies for each
encode message, gen(message_treat)
gen message_multi=0
recode message_multi (0=1) if message_treat==1

gen message_overt=0
recode message_overt (0=1) if message_treat==2


gen message_sec=0
recode message_sec (0=1) if message_treat==3

gen message_rel=0
replace message_rel=1 if message_treat==1 | message_treat==2

**Outcome variables**

*Generate Support for candidate 
gen candsupport=support
replace candsupport= AX if candsupport==.
replace candsupport= BD if candsupport==.

*Generate candidate qualified
gen candqualified= qualified
replace candqualified= AY if candqualified==.
replace candqualified= BE if candqualified==.

*Generate candidate represents
gen candrepresent=represent
replace candrepresent=AZ if candrepresent==.
replace candrepresent=BF if candrepresent==.

*Generate candidate religious
gen candreligious=religious
replace candreligious= BA if candreligious==.
replace candreligious=BG if candreligious==.

*Generate candidate eloquent
gen candeloquent= eloquent
replace candeloquent= BB if candeloquent==.
replace candeloquent= BH if candeloquent==.


*Generate candidate thoughtful
gen candthoughtful=thoughtful
replace candthoughtful=BC if candthoughtful==.
replace candthoughtful=BI if candthoughtful==.

**measure of compliance with dangers treatment***
sum highquality if dangers==1

**************************
**Demographic Covariates**
**************************

*Rename Religious
rename Religious responrelig

*Generate Christian Nationalism scale (Note that cnat_5 is not included because it was an attention check and that cnat_3 is reverse coded)
gen cnat= cnat_1+ cnat_2+6- cnat_3+ cnat_4+ cnat_6+ cnat_7
sum cnat
sum cnat, d
gen high_cnat=0
replace high_cnat=1 if cnat>18 & cnat~=.
replace high_cnat=. if cnat==.
tab responrelig high_cnat


*Generate party numeric (note that this includes leaners)
encode Party, gen(party_num)
gen democrat=0
replace democrat=1 if party_num==1
gen republican=0 
replace republican=1 if party_num==2

tab responrelig republican, row

*For pure partisans use these variable
gen democratpid=1 if pid1==1
recode democratpid (.=0)

gen republicanpid=1 if pid1==2
recode republicanpid (.=0)

gen independentpid=1 if pid1==3
recode independentpid (.=0)


recode pid1 (1=1) (2=3) (3=2), gen(pid_reordered)
label define pidlabel 1 "Democrat" 2 "Independent" 3 "Republican" 
label values pid_reordered pidlabel

**Other demographics**

*Race
split race, p(",")
destring race1 race2 race3 race4, replace

gen asian=1 if race1==1 
recode asian (.=0)
gen black=1 if race1==2 
recode black (.=0)
gen nativeamerican=1 if race1==3 
recode nativeamerican (.=0)
gen white=1 if race1==4 
recode white (.=0)
gen other=1 if race1==5 
recode other (.=0)
gen mixedrace=1 if race2!=.
recode mixedrace (.=0)

ttest cnat, by(white) unequal


recode latino (2=0)

ttest cnat, by(latino) unequal


*Gender
recode gender (1=0) (2=1) (3 4=.), gen(female)

*Education
gen college=0 if educ==1 | educ==2 | educ==3 | educ==4
replace college=1 if educ==5 | educ==6 |educ==7

*Political participation
gen evervoted=0
replace evervoted=1 if voted_ever==1

recode voted_2020 (2=0)

recode voted_2020 (.=0) if evervoted==0

recode workpols (2=0)



*Religiosity
recode oftenservices (1=5) (2=4) (3=3) (5=1) (4=2), gen(oftenservices_reordered)
label define oftenserviceslabel 1 "Never" 2 "A Few Times a Year" 3 "Once or Twice a Month" 4 "Almost Every Week" 5 "Every week"
label values oftenservices_reordered oftenserviceslabel

gen veryreligious=0
replace veryreligious=1 if oftenservices_reordered==4 | oftenservices_reordered==5

gen mostreligious=0
replace mostreligious=1 if oftenservices_reordered==5

gen childrelig=.
replace childrelig=1 if often12==1 | often12==2 | often12==3
replace childrelig=0 if often12==4 | often12==5 

gen believeingod=.
replace believeingod=1 if deitybelief==1 | deitybelief==2 | deitybelief==3
replace believeingod=0 if deitybelief==4 | deitybelief==5 | deitybelief==6 | deitybelief==7

recode deitybelief (1 2 3 4 =1) (5 6 7=0), gen(spiritual)

recode deitybelief (1=1) (2 3 4 5 6 7 =0), gen(beliefgodnodoubts)

gen mostfervent=0
replace mostfervent=1 if beliefgodnodoubts==1 & oftenservices==1

ttest believeingod, by(democrat) unequal
ttest responrelig, by(democrat) unequal
ttest spiritual, by(democrat) unequal

gen somehoursreligious=.
replace somehoursreligious=1 if timereligious>1 & timereligious~=.
replace somehoursreligious=0 if timereligious==1 

gen timereligious_rev=.
replace timereligious_rev=timereligious if timereligious>1 & timereligious~=.
replace timereligious_rev=0 if timereligious==1 

tab spiritual responrelig 

recode region (2 3 4=0), gen(northeast)
recode region (2=1) (1 3 4=0), gen(midwest)
recode region (3=1) (1 2 4=0), gen(south)
recode region (4=1) (1 2 3=0), gen(west)
label variable south South


tab religion, gen(denom)
rename denom1 catholic
rename denom2 mainline
rename denom3 evangelical
rename denom4 otherchristian
rename denom5 agnostic
rename denom6 atheist
rename denom7 none
rename denom8 secular
rename denom9 humanist 

gen notrelig=agnostic+atheist+none+secular+humanist

gen christian=-1*(notrelig-1)

gen secularism_index=-1*(personalsecularism_1+personalsecularism_2+personalsecularism_3+personalsecularism_4)+24

sum secularism_index, d

tab believeingod responrelig, row

gen religious_rev=.
replace religious_rev=1 if secularism_index<14
replace religious_rev=0 if (secularism_index>14 & secularism_index~=.) | (secularism_index==14) /*need to reverse scoring because 1 was more in agreement with secular statements in original survey*/

gen religiousnotsecular=.
replace religiousnotsecular=1 if religious_rev==1 & responrelig==1
replace religiousnotsecular=0 if religious_rev==0 | responrelig==0

gen religiousnat=.
replace religiousnat=1 if high_cnat==1 & responrelig==1
replace religiousnat=0 if high_cnat==0 | responrelig==0

gen notsecularnat=.
replace notsecularnat=1 if high_cnat==1 & religious_rev==1
replace notsecularnat=0 if high_cnat==0 | religious_rev==0

*Attention check question
gen inattentive=1
replace inattentive=0 if cnat_5==5 
replace inattentive=. if cnat_5==.
/*13.8% inattentive*/




**********************************
*****Tables in Main Text**********
**********************************

*TABLE 3: Interaction of Dangers Prime with Overt Message, 2nd Experiment

reg candsupport dangers##message_overt if religiousnat==1
reg candsupport dangers##message_overt if religiousnat==0
reg candsupport dangers##message_overt##religiousnat




***********************************
***Figures in Main Text******
***********************************


set scheme s2manual
label define dangerslabel 0 "No Reflection" 1 "Dangers Reflection"
label values dangers dangerslabel
label define overtlabel 0 "Multi/Secular Message" 1 "Overtly Religious Message"
label values message_overt overtlabel
label var candsupport "Candidate Support"
label var candqualified "Candidate is qualified"
label var candrepresent "Candidate represents me"
label var candthoughtful "Candidate is thoughtful"
label var candeloquent "Candidate is eloquent"



*Figure 9: Changes in Candidate Evaluations Following the Overtly Religious Message and Dangers Prime, Among Religious Christian Nationalists in the 2nd Experiment

reg candsupport i.dangers##i.message_overt if religiousnat==1, robust
estimates store support1
reg candqualified i.dangers##i.message_overt  if religiousnat==1, robust
estimates store qualified1
reg candrepresent i.dangers##i.message_overt  if religiousnat==1, robust
estimates store represent1
reg candthoughtful i.dangers##i.message_overt if religiousnat==1, robust
estimates store thoughtful1
reg candeloquent i.dangers##i.message_overt  if religiousnat==1, robust
estimates store eloquent1
coefplot support1 qualified1 represent1 thoughtful1 eloquent1, drop(_cons) xline(0) levels(90) graphregion(fcolor(white)) ylab(,nogrid)

****Figure 10: Changes in Candidate Evaluations Following the Overtly Religious Message and Dangers Prime, Among Non-Religious and Non-Christian Nationalists in the 2nd Experiment
reg candsupport i.dangers##i.message_overt if religiousnat==0, robust
estimates store support1
reg candqualified i.dangers##i.message_overt  if religiousnat==0, robust
estimates store qualified1
reg candrepresent i.dangers##i.message_overt  if religiousnat==0, robust
estimates store represent1
reg candthoughtful i.dangers##i.message_overt if religiousnat==0, robust
estimates store thoughtful1
reg candeloquent i.dangers##i.message_overt  if religiousnat==0, robust
estimates store eloquent1
coefplot support1 qualified1 represent1 thoughtful1 eloquent1, drop(_cons) xline(0) levels(90) graphregion(fcolor(white)) ylab(,nogrid)

**********************************
*** Tables in Appendix****
**********************************

*TABLE D1
tab responrelig religious_rev, row


*Table D9: Effects of Dangers Prime on Candidate Evaluation Following the Overtly Religious Message in Experiment 2, Those Who Do NOT Hold Secular Worldviews
reg candsupport dangers##message_overt if religious_rev==0
reg candqualified dangers##message_overt if religious_rev==0
reg candrepresent dangers##message_overt if religious_rev==0
reg candthoughtful dangers##message_overt if religious_rev==0
reg candeloquent dangers##message_overt if religious_rev==0


*Table D10: Effects of Dangers Prime on Candidate Evaluation Following the Overtly Religious Message in Experiment 2, Those Who Hold Secular Worldviews
reg candsupport dangers##message_overt if religious_rev==1
reg candqualified dangers##message_overt if religious_rev==1
reg candrepresent dangers##message_overt if religious_rev==1
reg candthoughtful dangers##message_overt if religious_rev==1
reg candeloquent dangers##message_overt if religious_rev==1

*Table D11: Effects of Dangers Prime on Candidate Evaluation Following the Overtly Religious Message in Experiment 2, Those Who Do Not Identify as Humanist, Secular, Atheist, Agnostic or None
reg candsupport dangers##message_overt if notrelig==0
reg candqualified dangers##message_overt if notrelig==0
reg candrepresent dangers##message_overt if notrelig==0
reg candthoughtful dangers##message_overt if notrelig==0
reg candeloquent dangers##message_overt if notrelig==0

***************************
*****Figures in Appendix****
****************************


gen experiment=1

append using "/Users/gwynethmcclendon/Dropbox/Paper AA-GM/Replication materials Overtly Religious Appeals JOP/anes_2016_recoded.dta", nolabel nonotes


drop if V161265x==-2|V161265x==6|V161265x==7
drop if V161005==2 | V161005==-8 | V161005==-9

label var democratpid Democrat
label var republicanpid Republican
label var independentpid Independent
label var white White
label var asian Asian
label var black Black
label var nativeamerican "Native American"
label var latino Latino
label var female Female
label var northeast Northeast
label var midwest Midwest
label var south South
label var west West

set scheme s2color

forv s = 0/1 {
			mean democratpid republicanpid independentpid white asian black nativeamerican latino female college northeast midwest south west if experiment==`s'
		estimate store m_`s'
}

coefplot m_0 m_1, graphregion(fcolor(white)) plotlabels("ANES 2016" "Experiment") levels(95)
